using System;
using System.IO;
using System.Web;

namespace System.Web.Core
{
    public class Avatar
    {
        private string fileName;
        private byte[] content;

        public Avatar()
        {

        }
        public Avatar(Stream stream)
        {
            content = new Byte[(int)stream.Length];
            stream.Position = 0;
            stream.Read(content, 0, (int)stream.Length);
        }
        public Avatar(HttpPostedFile postedFile)
        {
            fileName = postedFile.FileName.Substring(postedFile.FileName.LastIndexOf("\\") + 1);
            content = new Byte[postedFile.ContentLength];
            postedFile.InputStream.Read(content, 0, postedFile.ContentLength);
        }

        public string FileName
        {
            get
            {
                return fileName;
            }
            set
            {
                fileName = value;
            }

        }
        public Byte[] Content
        {
            get
            {
                return content;
            }
            set
            {
                content = value;
            }
        }
    }
}